include_defs('//lib/maven.defs')

genrule(
  name = 'bcprov__unsign',
  cmd = ' && '.join([
    'unzip -qd $TMP $(location //lib/bouncycastle:bcprov)',
    'cd $TMP',
    'zip -Drq $OUT . -x META-INF/\*.RSA META-INF/\*.DSA META-INF/\*.SF META-INF/\*.LIST',
  ]),
  out = 'bcprov-unsigned.jar',
)

prebuilt_jar(
  name = 'bcprov',
  binary_jar = ':bcprov__unsign',
)

genrule(
  name = 'bcpkix__unsign',
  cmd = ' && '.join([
    'unzip -qd $TMP $(location //lib/bouncycastle:bcpkix)',
    'cd $TMP',
    'zip -Drq $OUT . -x META-INF/\*.RSA META-INF/\*.DSA META-INF/\*.SF META-INF/\*.LIST',
  ]),
  out = 'bcpkix-unsigned.jar',
)

prebuilt_jar(
  name = 'bcpkix',
  binary_jar = ':bcpkix__unsign',
)

java_library(
  name = 'convertkey__lib',
  srcs = glob(['src/main/java/**/*.java']),
  deps = [
    ':bcprov',
    ':bcpkix',
    '//lib:jsch',
    '//lib/log:nop',
    '//lib/mina:sshd',
  ],
)

java_binary(
  name = 'convertkey',
  deps = [':convertkey__lib'],
  main_class = 'com.googlesource.gerrit.convertkey.ConvertKey',
)

